package ui_window;

import config.FrameConfig;
import config.GameConfig;
import util.FrameUtil;

import javax.swing.JFrame;

public class JFrameGame extends JFrame {
    public JFrameGame(JPanelGame panelGame){
        //获取游戏配置
        FrameConfig fCfg = GameConfig.getFrameConfig();
        //设置标题
        this.setTitle(fCfg.getTitle());
        //设置关闭属性(程序结束)
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //设置窗口大小
        this.setSize(fCfg.getWidth(),fCfg.getHeight() );
        //不允许改变窗口大小
        this.setResizable(false);
        //居中
        FrameUtil.setFrameCenter(this);
        //设置默认Panel
        this.setContentPane(panelGame);
        //默认改窗口为显示
        this.setVisible(true);
    }
}
